<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>

<div class="header">
	<h3>导入流程</h3>
</div>
<table class="form-table">
	<tr>
		<td class="td1">流程名称：</td>
		<td class="td2"><input type="text" id="processName"
			class="required"></td>
	</tr>
	<tr>
		<td class="td1">流程Key：</td>
		<td class="td2"><input type="text" id="processKey"
			class="required"></td>
	</tr>
	<tr style="display:none">
		<td class="td1">上传流程定义文件:</td>
		<td class="td2">
			<form id="importFileForm" action="fileUpload" method="post"
				enctype="multipart/form-data">
				<input id="xmlFile" name="xmlFile" type="file" style="width:90%">（仅支持bpmn20.xml格式）
			</form></td>
	</tr>
</table>

<isperp:buttonList>
	<button onclick="importProcess();" class="nui-mainbtn">保存</button>
</isperp:buttonList>

<script type="text/javascript">
	function importProcess() {
		var processKey = $("#processKey").val();
		var processName = $("#processName").val();

		$.post("workflow/processDefinition/deployNewProcess", {
			processKey : processKey,
			processName : processName
		}, function() {
			isperp.infoAlert("流程导入成功！");
		});


/*		$.ajax({
			//提交数据的类型 POST GET
			type:"GET",
			//提交的网址
			url:"constract/tmc/aaa",
			//提交的数据   该参数为属性值类型的参数         //（和url?Name="sanmao"&Password="sanmapword"一样）后台若为SpringMVC接受，注明@RequestParam
			data:{processKey:processKey,processName:processName},
			//返回数据的格式
			datatype: "json",//"xml", "html", "script", "json", "jsonp", "text".
			//在请求之前调用的函数
			//beforeSend:function(){$("#msg").html("logining");},
			//成功返回之后调用的函数
			success:function(data){
				console.log("流程导入成功！");
			} ,
			//调用执行后调用的函数
			/!*complete: function(XMLHttpRequest, textStatus){
				alert(XMLHttpRequest.responseText);
				alert(textStatus);
				//HideLoading();
			},*!/
			//调用出错执行的函数
			error: function(){
				//请求出错处理
				console.log("流程导入失败！");
			}
		});*/



	}
</script>